/**
 * Project  : monkey
 * Author   : Wu Tian Qiang
 * Date     : 2016/10/18 20:49:30
 */
Ext.define('Monkey.view.user.UserWindow', {
    extend: 'Ext.window.Window',

    controller: 'ctrl-user',
    viewModel: 'vm-user',
    closable: true,
    resizable: true,
    constrain: true,
    constrainHeader: true,
    modal: true,
    frameHeader: false,
    frame: true,
    maximizable: false,
    layout: 'fit',
    width: 360,
    height: 500,
    initComponent: function () {
        var form = {
            xtype: 'form',
            border: false,
            buttonAlign: 'center',
            reference: 'form',
            layout: 'form',
            bodyStyle: 'padding:15px 5px 0 5px',
            defaults: {
                labelWidth: 80,
                labelAlign: 'right'
            },
            defaultType: 'textfield',
            buttons: [{
                formBind: true,
                text: '确定',
                iconCls: 'accept',
                handler: 'ok'
            }, {
                text: '取消',
                iconCls: 'delete',
                handler: 'cancel'
            }]
        };

        form.items = [{
            editable: false,
            xtype: 'orgtreepicker',
            allowBlank: false,
            fieldLabel: '<span style="color: red;">*</span>所属组织',
            name: 'orgId',
            bind: '{orgId}'
        }, {
            bind: '{account}',
            name: 'account',
            maxLength: '10',
            minLength: '3',
            allowBlank: false,
            fieldLabel: '<span style="color: red;">*</span>登录帐号'
        }, {
            bind: '{password}',
            name: 'password',
            maxLength: '20',
            minLength: '6',
            inputType: 'password',
            allowBlank: false,
            fieldLabel: '<span style="color: red;">*</span>初始密码'
        }, {
            bind: '{nick}',
            name: 'nick',
            maxLength: '20',
            minLength: '6',
            allowBlank: false,
            fieldLabel: '<span style="color: red;">*</span>昵称'
        }, {
            bind: '{email}',
            name: 'email',
            allowBlank: false,
            vtype: 'email',
            fieldLabel: '<span style="color: red;">*</span>邮箱'
        }, {
            bind: '{mobile}',
            name: 'mobile',
            allowBlank: false,
            maxLength: '11',
            minLength: '11',
            fieldLabel: '<span style="color: red;">*</span>移动电话'
        }, {
            bind: '{cardId}',
            name: 'cardId',
            maxLength: '35',
            fieldLabel: '身份证号码'
        }, {
            bind: '{QQ}',
            name: 'QQ',
            maxLength: '20',
            fieldLabel: 'QQ'
        }, {
            bind: '{address}',
            name: 'address',
            maxLength: '100',
            fieldLabel: '联系地址'
        }, {
            bind: '{birthday}',
            name: 'birthday',
            xtype: 'datefield',
            maxValue: new Date(),
            format: 'Y-m-d',
            fieldLabel: '生日'
        }, {
            bind: '{status}',
            name: 'status',
            xtype: 'combobox',
            editable: false,
            allowBlank: false,
            fieldLabel: '状态',
            displayField: 'label',
            valueField: 'value',
            store: Monkey.Config.userStatusStore
        }, {
            bind: '{sex}',
            name: 'sex',
            xtype: 'combobox',
            editable: false,
            allowBlank: false,
            fieldLabel: '性别',
            displayField: 'label',
            valueField: 'value',
            store: Monkey.Config.userSexStore
        }, {
            bind: '{remark}',
            name: 'remark',
            maxLength: '100',
            xtype: 'textareafield',
            grow: true,
            fieldLabel: '备注'
        }, {
            bind: '{id}',
            name: 'id',
            xtype: 'hidden'
        }];

        this.items = [form];
        this.callParent();
    }
});